import time
import sys
import os
from paddleocr import PaddleOCR
parent_folder_path = os.path.abspath(os.path.join(
    os.path.dirname(__file__), '..'))
sys.path.append(parent_folder_path)
from libs.utils import read_image,write_image
if len(sys.argv) >1:
    img = read_image(sys.argv[1])
else:
    from libs.appium_driver import driver
    img = driver.getScreenshotForCv2()



originalOcr = PaddleOCR(lang="ch", show_log=False)
start = time.time()
result = originalOcr.ocr(img,cls=False)
print(f'time: {time.time()-start}')
for item in result:
     for res in result:
        if res is None:
            continue
        for line in res:
            print(line[1][0])
